package com.ys.enume.sys;

public class YsColEnum {
	// 字段类型
	public enum Type {
		TEXT("文本输入框", "t_text"),
		TEXT_NUMBER("数值输入框", "t_decimal"),
		TEXT_AREA("文本区域", "t_textarea"),
		FILE("附件", "t_file"),
		FILE_MULTY("附件(多)", "t_file_multy"),
		IMG("图片", "t_file2"),
		SELECTOR_DROPDOWN("下拉框", "t_dropdown"),
		SELECTOR_MODAL("弹出框", "t_buttontext"),
		SELECTOR_SWITCH("选择框(转换)", "t_checkbox"),
		RADIO("单选按钮", "t_radio"),
		SELF_DEFINE_TPL("自定义脚本", "t_self_define_tpl");
		public String name;
		public String value;

		private Type(String name, String value) {
			this.name = name;
			this.value = value;
		}

		public static String getName(String value) {
			for (Type e : Type.values()) {
				if (e.value == value) {
					return e.name;
				}
			}

			return "";
		}
		
		public static boolean checkIn(String value) {
			if (value == null) {
				return false;
			} else {
				for (Type e : Type.values()) {
					if (value.equals(e.value)) {
						return true;
					}
				}
			}
			return false;
		}
	}
	
	// 权限类型
	public enum AuthType {
		ALL("全部权限", 1), OPERATOR("运营权限", 2), DEPT("机构权限", 3), USER("个人权限", 4);
		public String name;
		public Integer value;

		private AuthType(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
		
		public static boolean checkIn(Integer value) {
			if (value == null) {
				return false;
			} else {
				for (AuthType e : AuthType.values()) {
					if (value == e.value) {
						return true;
					}
				}
			}
			return false;
		}
	}
	
	// 前台控件类型
	public enum FrontType {
		TEXT("文本框", "t_text"),
		FILE("附件", "t_file"),
		FILE_MULTY("附件(多)", "t_file_multy"),
		IMG("图片", "t_file2"),
		SELECTOR_DROPDOWN("下拉框", "t_dropdown"),
		SELECTOR_MODAL_SINGLE("弹出框(单选)", "t_buttontext"),
		SELECTOR_SWITCH("选择框(转换)", "t_checkbox"),
		HYPER_LINK("超链接", "t_hyperlink"),
		SELF_DEFINE_TPL("自定义脚本", "t_self_define_tpl");
		public String name;
		public String value;

		private FrontType(String name, String value) {
			this.name = name;
			this.value = value;
		}

		public static String getName(String value) {
			for (FrontType e : FrontType.values()) {
				if (e.value == value) {
					return e.name;
				}
			}

			return "";
		}
		
		public static boolean checkIn(String value) {
			if (value == null) {
				return false;
			} else {
				for (FrontType e : FrontType.values()) {
					if (value.equals(e.value)) {
						return true;
					}
				}
			}
			return false;
		}
	}
	
	// 前台是否查询
	public enum FrontConditionState {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FrontConditionState(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 前台是否固定
	public enum FrontFixed {
		NO("无固定", 0), LEFT("左固定", 1), RIGHT("右固定", 2);
		public String name;
		public Integer value;

		private FrontFixed(String name, Integer value) {
			this.name = name;
			this.value = value;
		}

		public static String getLayerFiexd(Integer value) {
			if (value == null || value == NO.value) {
				return null;
			} else if (value == LEFT.value) {
				return "left";
			} else if (value == RIGHT.value) {
				return "right";
			}
			return null;
		}
	}
	
	// 前台对齐方式
	public enum FrontAlign {
		CENTER("中间对齐", 0), LEFT("左对齐", 1), RIGHT("右对齐", 2);
		public String name;
		public Integer value;

		private FrontAlign(String name, Integer value) {
			this.name = name;
			this.value = value;
		}

		public static String getLayerAlign(Integer value) {
			if (value == null || value == CENTER.value) {
				return "center";
			} else if (value == LEFT.value) {
				return "left";
			} else if (value == RIGHT.value) {
				return "right";
			}
			return null;
		}
	}
	
	// 字段显示控制
	public enum FrontShow {
		SHOW("显示", 1),
		HIDDEN("隐藏", 0);
		public String name;
		public Integer value;

		private FrontShow(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 查询条件类型
	public enum FrontConditionType {
		TEXT("文本输入框", "t_text"),
		DATE_YY("年份选择框", "t_year"),
		DATE_YYMM("年月选择框", "t_monthly"),
		DATE_YYMMDD("日期选择框", "t_date"),
		DATE_YYMMDDHHMMSS("日期时间选择框", "t_datetime"),
		SELECTOR_DROPDOWN("下拉框", "t_dropdown"),
		SELECTOR_MODAL_SINGLE("弹出框(单选)", "t_buttontext"),
		SELECTOR_SWITCH("选择框(转换)", "t_checkbox"),
		RADIO("单选按钮", "t_radio"),
		CONDITION("钩选查询条件", "t_checkcondition");
		public String name;
		public String value;

		private FrontConditionType(String name, String value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 是否可编辑
	public enum FrontEdit {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FrontEdit(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 查询条件范围类型
	public enum FrontConditionRangeType {
		SYSTEM("精确匹配", "t_system"),
		BOTHLIKE("模糊匹配", "t_bothlike"),
		LEFTLIKE("左模糊", "t_leftlike"),
		RIGHTLIKE("右模糊", "t_rightlike"),
		EQUAL("相等", "t_equal"),
		UNEQUAL("不等", "t_unequal"),
		GREATER("大于", "t_greater"),
		SMALLER("小于", "t_smaller"),
		UNGREATER("不大于", "t_ungreater"),
		UNSMALLER("不小于", "t_unsmaller"),
		BETWEEN("区间", "t_between");
		public String name;
		public String value;

		private FrontConditionRangeType(String name, String value) {
			this.name = name;
			this.value = value;
		}

		public static String getName(String value) {
			for (FrontConditionRangeType e : FrontConditionRangeType.values()) {
				if (e.value.equals(value)) {
					return e.name;
				}
			}
			return "";
		}
	}
	
	// 表单占据长度
	public enum FormLength {
		ONE("1/3行", 1), TWO("2/3行", 2), THREE("一整行", 3);
		public String name;
		public Integer value;

		private FormLength(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单是否新增
	public enum FormAddState {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormAddState(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单新增控件类型
	public enum FormAddType {
		TEXT("文本框", "t_text"),
		TEXT_NUMBER("数值输入框", "t_number"),
		TEXTAREA("文本域", "t_textarea"),
		FILE_SINGLE("附件(单选)", "t_file"),
		FILE_MULTY("附件(多选)", "t_file_multy"),
		IMG("图片", "t_file2"),
		DROPDOWN_SINGLE("下拉框(单选)", "t_dropdown"),
		DROPDOWN_MULTY("下拉框(多选)", "t_dropdown_multy"),
		SELECTOR_MODAL_SINGLE("弹出框(单选)", "t_buttontext"),
		SELECTOR_MODAL_MULTY("弹出框(多选)", "t_buttontext_multy"),
		SELECTOR_SWITCH("选择框(转换)", "t_checkbox"),
		SELF_DEFINE_TPL("自定义脚本", "t_self_define_tpl");
		public String name;
		public String value;

		private FormAddType(String name, String value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单新增是否必填
	public enum FormAddRequired {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormAddRequired(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单新增是否只读
	public enum FormAddReadonly {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormAddReadonly(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单新增隐藏
	public enum FormAddHidden {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormAddHidden(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单是否编辑
	public enum FormEditState {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormEditState(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单编辑是否必填
	public enum FormEditRequired {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormEditRequired(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单编辑控件类型
	public enum FormEditType {
		TEXT("文本框", "t_text"),
		TEXT_NUMBER("数值输入框", "t_number"),
		FILE_SINGLE("附件(单选)", "t_file"),
		FILE_MULTY("附件(多选)", "t_file_multy"),
		IMG("图片", "t_file2"),
		DROPDOWN_SINGLE("下拉框(单选)", "t_dropdown"),
		DROPDOWN_MULTY("下拉框(多选)", "t_dropdown_multy"),
		SELECTOR_MODAL_SINGLE("弹出框(单选)", "t_buttontext"),
		SELECTOR_MODAL_MULTY("弹出框(多选)", "t_buttontext_multy"),
		SELECTOR_SWITCH("选择框(转换)", "t_checkbox"),
		SELF_DEFINE_TPL("自定义脚本", "t_self_define_tpl");
		public String name;
		public String value;

		private FormEditType(String name, String value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单编辑是否只读
	public enum FormEditReadonly {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormEditReadonly(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单编辑隐藏
	public enum FormEditHidden {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormEditHidden(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单详情是否展示
	public enum FormDetailState {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FormDetailState(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 表单详情控件类型
	public enum FormDetailType {
		TEXT("文本框", "t_text"),
		TEXT_NUMBER("数值输入框", "t_number"),
		FILE_SINGLE("附件(单选)", "t_file"),
		FILE_MULTY("附件(多选)", "t_file_multy"),
		IMG("图片", "t_file2"),
		DROPDOWN_SINGLE("下拉框(单选)", "t_dropdown"),
		DROPDOWN_MULTY("下拉框(多选)", "t_dropdown_multy"),
		SELECTOR_MODAL_SINGLE("弹出框(单选)", "t_buttontext"),
		SELECTOR_MODAL_MULTY("弹出框(多选)", "t_buttontext_multy"),
		SELECTOR_SWITCH("选择框(转换)", "t_checkbox"),
		SELF_DEFINE_TPL("自定义脚本", "t_self_define_tpl");
		public String name;
		public String value;

		private FormDetailType(String name, String value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 是否导入
	public enum ImportState {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private ImportState(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}

	// 是否导出
	public enum FrontExport {
		SHOW("显示", 1),
		HIDDEN("隐藏", 0);
		public String name;
		public Integer value;

		private FrontExport(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
}
